import { Module } from '@nestjs/common';
import { LoginController } from './login.controller';
import { LoginService } from './login.service';
import { UserModule } from '../user/user.module';
import { JwtModule } from '@nestjs/jwt';
import { ConfigModule } from '@nestjs/config';
import { PassportModule } from '@nestjs/passport';
import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from '../../entities/user.entity';
import { CommonModule } from '../common/common.module';

@Module({
  imports: [
    UserModule,
    ConfigModule,
    PassportModule,
    CommonModule,
    TypeOrmModule.forFeature([User]),
    JwtModule.register({
      secret: process.env.JWT_SECRET || '123',
       // 签名选项
      signOptions: {
        expiresIn:   '1d', // 过期时间
        algorithm: 'HS256', // 签名算法
      },
    }), 
  ],
  controllers: [LoginController],
  providers: [LoginService],
  exports: [LoginService],
})
export class LoginModule {}
